<template>
	<button class="avatar-container" type="default" @click="getUserProfile" plain="true">
		<slot name="img"></slot>
	</button>
</template>

<script>
	export default {
		methods: {
			getUserProfile(e) {
				uni.getUserProfile({
					desc: '用于完善会员资料', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
					success: (res) => {
						this.$emit('onClick', {
							userInfo: res.userInfo,
							hasUserInfo: true
						})
					}
				})
			}
		}
	}
</script>

<style>
	.avatar-container {
		padding: 0 !important;
		border: none !important;
		/* background-color: none !important; */
	}
</style>
